<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head>
    <th:block th:include="include :: header('文件配置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <div class="col-sm-6">
        <div class="tabs-container">
            <ul class="nav nav-tabs" id="oss-title">
                <li class="active"><a data-toggle="tab" href="#tab-local" aria-expanded="true"> 本地存储</a>
                </li>
                <li class=""><a data-toggle="tab" href="#tab-qiniu" aria-expanded="false">七牛云存储</a>
                </li>
            </ul>
            <div class="tab-content">
                <div id="tab-local" class="tab-pane active">
                    <div class="panel-body">
                        <form class="form-horizontal m" id="form-local">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">域名：</label>
                            <div class="col-sm-8">
                                <input class="form-control" name="oss_local_domain" type="text"  th:value="${ossConfig['oss_local_domain']}">
                            </div>
                        </div>
                        </form>
                    </div>
                </div>
                <div id="tab-qiniu" class="tab-pane">
                    <div class="panel-body">
                        <form class="form-horizontal m" id="form-qiniu">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">域名：</label>
                                <div class="col-sm-8">
                                    <input class="form-control" type="text"  name="oss_qiniu_domain" th:value="${ossConfig['oss_qiniu_domain']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">AccessKey：</label>
                                <div class="col-sm-8">
                                    <input   class="form-control" type="text" name="oss_qiniu_access_key" th:value="${ossConfig['oss_qiniu_access_key']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">SecretKey：</label>
                                <div class="col-sm-8">
                                    <input   class="form-control" type="text" name="oss_qiniu_secret_key" th:value="${ossConfig['oss_qiniu_secret_key']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">空间名：</label>
                                <div class="col-sm-8">
                                    <input   class="form-control" type="text" name="oss_qiniu_bucket" th:value="${ossConfig['oss_qiniu_bucket']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">机房：</label>
                                <div class="col-sm-8">
                                    <input   class="form-control" type="text" name="oss_qiniu_zone" th:value="${ossConfig['oss_qiniu_zone']}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">缩略图规则：</label>
                                <div class="col-sm-8">
                                    <input   class="form-control" type="text" name="oss_qiniu_style_rule" th:value="${ossConfig['oss_qiniu_style_rule']}">
                                </div>
                            </div>
                        </form>
                        </div>
                    </div>
                </div>
        </div>
    </div>
    <br>
    <button type="button" class="btn btn-w-m btn-primary" id="submit-btn">修改</button>
</div>
<div th:include="include::footer"></div>
<script>
    var prefix = ctx + "system/config";
    var myForm="form-local";
    $('#oss-title a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
       myForm= $(this).attr('href').replace("#tab-","form-");
       console.log(myForm);
    });
    function submitHandler() {
            $.operate.save(prefix + "/updateByKey", $('#'+myForm).serialize());

    }
    $("#submit-btn").click(function (){
        submitHandler();
    })
</script>
</body>
</html>
